/*
 * Label.cpp
 *
 *  Created on: 18.2.2013
 *      Author: Travis
 */

#ifdef _WIN32 
#include <windows.h> 
#endif

#include "Label.h"

namespace Gadgets
{

Label::Label(int _width, int _height) :
		Form(_width, _height)
{
	caption = "";

	text = new glFont(Engine::fontSettings.fontFile);
	text->BuildFont();
}

Label::~Label()
{
}

void Label::draw()
{
	if (visible)
	{
		if (background != NULL)
			if (root != NULL)
				background->draw(root->getPos() + Pos);
			else
				background->draw(Pos);

		if (root != NULL)
			text->glPrint(root->getPos().x + Pos.x, root->getPos().y + Pos.y, 0,
					caption.c_str());
		else
			text->glPrint(Pos.x, Pos.y, 0, caption.c_str());
	}
}

const std::string& Label::getCaption() const
{
	return caption;
}

void Label::setCaption(const std::string& caption)
{
	this->caption = caption;
}

} /* namespace Gadgets */
